<?php
namespace app\model;

class ScriptInfo extends BaseModel
{
    protected $name = 'script_info';
    
    protected $autoWriteTimestamp = true;
    
    protected $type = [
        'create_time' => 'integer',
        'update_time' => 'integer',
        'delete_time' => 'integer'
    ];

    // 剧本类型常量
    const TYPE_STUDY = 'STUDY';
    const TYPE_TEST = 'TEST';

    // 剧本权限常量
    const PERMISSION_PRIVATE = 'PRIVATE';
    const PERMISSION_PUBLIC = 'PUBLIC';

    /**
     * 关联用户
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    /**
     * 关联对话内容
     */
    public function dialogues()
    {
        return $this->hasMany(ScriptDialogue::class, 'script_id');
    }
} 